<template>
    <div class="loading">
        <div class="box">
            <Spin :indicator="indicator" spinning> </Spin>
            <span>{{ loadingTitle }}</span>
        </div>
    </div>
</template>

<script setup>
import { h, onMounted, ref, watch } from 'vue';
import { Spin } from 'ant-design-vue'
import { Loading3QuartersOutlined } from '@ant-design/icons-vue';
const indicator = h(Loading3QuartersOutlined, {
    style: {
        fontSize: '32px',
        color: '#d6e3ff'
    },
    spin: true,
});

const loadingTitle = ref('加载中...')

const props = defineProps({
    title: {
        type: String,
        default: ''
    }
})

watch(() => props.title, (val) => {
    console.log(val);
})

onMounted(() => {
    loadingTitle.value = props.title || '加载中...'
})

const changeTitle = (title) => {
    loadingTitle.value = title
}

defineExpose({
    changeTitle
})



</script>

<style lang="less" scoped>
.loading{
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 9999999999999;
    .align(center);
    .box{
        .align(center, column);
        width: 100px;
        height: 100px;
        border-radius: 10px;
        background: rgba(0, 0, 0, 0.5);
        span{
            margin-top: 5px;
            color: #d6e3ff;
        }
    }
}
</style>
